{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = np.array([[1.2, 1.5, 1.8],\n",
    "             [1.3, 1.4, 1.9],\n",
    "             [1.1, 1.6, 1.7]])\n",
    "Y = np.array([5, 10, 9]).T\n",
    "Z = np.zeros(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10.3 µs ± 51.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%%timeit\n",
    "for i in range(0, X.shape[0]):\n",
    "    for j in range(0, X.shape[1]):\n",
    "        Z[i] += X[i, j] * Y[j]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[37.2 37.6 36.8]\n"
     ]
    }
   ],
   "source": [
    "Z = np.zeros(3)\n",
    "for i in range(0, X.shape[0]):\n",
    "    for j in range(0, X.shape[1]):\n",
    "        Z[i] += X[i, j] * Y[j]\n",
    "print(Z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.46 µs ± 3.13 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)\n",
      "[37.2 37.6 36.8]\n"
     ]
    }
   ],
   "source": [
    "%timeit S = np.dot(X, Y)\n",
    "print(S)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
